<template>
    <div>
        <top-simple-search @searchFun="query" @addFun="handleAdd">
          <el-form-item label="状态">
            <el-select v-model="formData.is_draft" clearable>
              <el-option label="待处理" :value="1"></el-option>
              <el-option label="待确认" :value="4"></el-option>
              <el-option label="待维修" :value="6"></el-option>
              <el-option label="已维修" :value="7"></el-option>
              <el-option label="已完成" :value="8"></el-option>
              <el-option label="已评价" :value="9"></el-option>
              <el-option label="已取消" :value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="申请时间">
            <el-date-picker
              v-model="formData.start_time"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              placeholder="请选择开始时间"
              size="small"
              clearable
              style="margin-right: 10px;width: 180px"
            ></el-date-picker>
            <el-date-picker
              v-model="formData.end_time"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              placeholder="请选择结束时间"
              size="small"
              clearable
              style="margin-right: 10px;width: 180px"
            ></el-date-picker>
          </el-form-item>
        </top-simple-search>
        <dynamic-table ref="myTable" :params="params" v-bind="$attrs" :config="config" >
          <template slot-scope="{row}">

            <dispatch-button v-if="params.category == 'jiedan'" :row="row"></dispatch-button>
            <chuli-button @click="toHandle(row)" v-if="isTodo"></chuli-button>
            <detail-button @click="toView(row)" v-else></detail-button>
            <my-button handle="Create" v-if="row.cancel_flag" @click="toCancel(row)">取消</my-button>
          </template>
        </dynamic-table>

    </div>
</template>
<script>
  import address from "@/api/onlineRepair/address/index"
    import MyLink from "@/components/MyLink/index";
    import ExtendTable from "@/mixins/ExtendTable";
  import DynamicTable from "@/components/Common/DynamicTable";
  import DispatchButton from "@/components/WorkFlowsDialog/Case/Buttons/dispatchButton";
    export default {
        name: "ListTable",
        components: {DispatchButton, DynamicTable,   MyLink},
        props: ["params","appFun"],
       mixins:[ExtendTable],
        data() {
            return {
              config: [],
              xqList:[],
            }
        },
        created() {
          const config = require(`@/views/onlineRepair/list/js/tableconfig.js`);
          this.config = config.default.column
          this.getXqList()
        },
        computed: {
            isDraft() {
                return this.params.is_draft
            },
            isTodo() {
                return this.params.category=='duty'
            },
            isYiban() {
                return this.params.category=='relation'
            },
            isFaqi() {
                return this.params.category=='owner'
            },
        },
        methods: {
          getXqList(){
            address.getList({level:0}).then(res=>{
              this.xqList = res.data
            })
          },
          loadComplete(data){
          }
        }
    }
</script>
<style lang="scss" scoped>
    .fwh {
        ::v-deep.el-input__inner {
            padding: 0 8px;
        }
        ::v-deep.el-input__suffix{
            right: 0px;
        }
    }

</style>
